import { ApiCall } from "tsrpc";
import { ReqEquipList, ResEquipList, api_equipList_item } from "../../../shared/master/body/PtlEquipList";
import { player } from "../../../model/fight/body/player";

export default async function (call: ApiCall<ReqEquipList, ResEquipList>) {
    let user = call.req._player as player;
    
    let list:(undefined|api_equipList_item)[] = []
    for (let index = 0; index < user.equip_ordinary.length; index++) {
        const element = user.equip_ordinary[index];
        if(!element){
            list.push(undefined);
            continue;
        }
        list.push({
            name:element.name,
            icon:element.icon,
            leve:element.leve.num,
        })
    }
    call.succ({list:list})
}